<? $desc = trim(@$category['Category']['description']) ?>
<? if(! empty($desc)): ?>
    <p><?= nl2br($desc) ?></p>
<? endif ?>

<? if (! empty($category['SubCategory'])): ?>
    <?= $this->element('list', array(
        'data' => $category['SubCategory'],
        'pattern' => array(
            'id' => 'id',
            'title' => 'name',
            'image' => 'image'
        ),
        'image_base' => 'categories/',
        'image_base_pattern' => '',
        'href' => '/proizvodi/{key}'
    )) ?>
<? else: ?>
    <? if(!empty($products)): ?>
    	<?= $this->element('list', array(
    		'data' => $products,
    		'pattern' => array(
    			'id' => 'Product.id',
    			'title' => 'Product.name',
    			'image' => 'ProductImage.0.src'
    		),
    		'image_base' => 'products/',
    		'image_base_pattern' => 'Product.id',
    		'href' => '/proizvodi/proizvod/{Product.id}/{Product.name}'
    	)) ?>
    <? else: ?>
    <p>Trenutno nema proizvoda u ovoj kategoriji.</p>
    <? endif; ?>
<? endif ?>